﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace Assets.Scripts
{
	[RequireComponent(typeof(TrailRenderer))]
	class MyTrail : MonoBehaviour
	{
		private TrailRenderer trailRenderer;

		[Header("如果使用自定义颜色，请勾选")]
		public bool isConstom = false;
		[SerializeField]
		private Color startColor;
		[SerializeField]
		private Color endColor;

		private void Start()
		{
			trailRenderer = GetComponent<TrailRenderer>();
			if (!isConstom)
			{
				trailRenderer.startColor = GetComponentInParent<Renderer>().material.GetColor("EmissionColor");
				trailRenderer.endColor = GetComponentInParent<Renderer>().material.GetColor("EmissionColor");
			}
		}
	}
}
